package com.pwser.helloworld;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableAutoConfiguration //创建Tomcat并自动注入spring配置
@RestController //所用方法全部返回Json数据
@RequestMapping("/hw")
public class HelloWorldController {

	@RequestMapping("/index")
	public String index() {
		return "success";
	}
	
	@RequestMapping("/getMap")
	public Map<String, Object> getMap() {
		Map<String, Object> hashMap = new HashMap<String, Object>();
		hashMap.put("errorCode", "200");
		hashMap.put("errorMsg", "成功");
		return hashMap;
	}
	
	public static void main(String[] args) {
		//主函数运行springboot项目
		SpringApplication.run(HelloWorldController.class, args);
	}
}
